program main
    implicit none
    real,parameter :: a=0.0,b=1
    integer,parameter :: n=100
    real :: s,h
    integer :: i
    real :: x(n+1),y(n+1)
    h=(b-a)/n
    forall(i=1:n+1) x(i)=a+h*(i-1)
    y=sin(x)
    s=sum(h*(y(1:n)+y(2:n+1))/2.0)
    write(*,100)a,b,n
    write(*,200)s
100 format('a=',f6.3,4x,'b=',f6.3,4x,'n=',i5)
200 format('s=',f15.8)
end program
